package org.example;

public class 第二十五章_接口 {
    public static void main(String[] args) {
        Animal animal1 = new Cat();
        Animal animal = new Dog();

        animal1.eat();
        animal.eat();
    }

    interface Animal {
        public void eat();
    }

    static class Cat implements Animal{
        @Override
        public void eat() {
            System.out.println("吃鱼");
        }
    }

    static class Dog implements Animal{
        @Override
        public void eat() {
            System.out.println("吃骨头");
        }
    }
}
